package com.cubeofnine.sugar.service.element;

import java.util.Hashtable;

import org.ksoap2.serialization.KvmSerializable;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;

public class RelationshipValue implements KvmSerializable {
	private String module1;
	private String module1_id;
	private String module2;
	private String module2_id;

	public RelationshipValue() {

	}

	public RelationshipValue(SoapObject obj) {
		this.module1 = obj.getProperty("module1").toString();
		this.module1_id = obj.getProperty("module1_id").toString();
		this.module2 = obj.getProperty("module2").toString();
		this.module2_id = obj.getProperty("module2_id").toString();
	}

	public Object getProperty(int index) {
		Object object = null;

		switch (index) {
		case 0:
			object = this.module1;
			break;
		case 1:
			object = this.module1_id;
			break;
		case 2:
			object = this.module2;
			break;
		case 3:
			object = this.module2_id;
			break;
		}

		return object;
	}

	public int getPropertyCount() {
		return 4;// Count GloVariable
	}

	public void getPropertyInfo(int index, Hashtable arg1,
			PropertyInfo propertyInfo) {
		switch (index) {
		case 0:
			propertyInfo.name = "module1";
			propertyInfo.type = PropertyInfo.STRING_CLASS;
			break;
		case 1:
			propertyInfo.name = "module1_id";
			propertyInfo.type = PropertyInfo.STRING_CLASS;
			break;
		case 2:
			propertyInfo.name = "module2";
			propertyInfo.type = PropertyInfo.STRING_CLASS;
			break;
		case 3:
			propertyInfo.name = "module2_id";
			propertyInfo.type = PropertyInfo.STRING_CLASS;
			break;
		}
	}

	public void setProperty(int index, Object obj) {
		switch (index) {
		case 0:
			this.module1 = obj.toString();
			break;
		case 1:
			this.module1_id = obj.toString();
			break;
		case 2:
			this.module2 = obj.toString();
			break;
		case 3:
			this.module2_id = obj.toString();
			break;
		}
	}

	public String getModule1() {
		return module1;
	}

	public void setModule1(String module1) {
		this.module1 = module1;
	}

	public String getModule1_id() {
		return module1_id;
	}

	public void setModule1_id(String module1_id) {
		this.module1_id = module1_id;
	}

	public String getModule2() {
		return module2;
	}

	public void setModule2(String module2) {
		this.module2 = module2;
	}

	public String getModule2_id() {
		return module2_id;
	}

	public void setModule2_id(String module2_id) {
		this.module2_id = module2_id;
	}

}
